import service from "@/utils/request";
import type { Response, PageResponse, CodeName } from "@/types/common";

// <any, Response<PageResponse<DevPageItem>>>
// <any, Response<DevPageItem>>
export const useAccessCasbinPageApi = (params: object) => {
  return service({
    url: `/v1/access/casbin/page`,
    method: "GET",
    params,
  });
};
export const useAccessCasbinQueryApi = (params: object) => {
  return service({
    url: `/v1/access/casbin/query`,
    method: "GET",
    params,
  });
};

export const useAccessCasbinCreateApi = (data: object) => {
  return service({
    url: `/v1/access/casbin/create`,
    method: "POST",
    data,
  });
};

export const useAccessCasbinUpdateApi = (data: object) => {
  return service({
    url: `/v1/access/casbin/update`,
    method: "POST",
    data,
  });
};

export const useAccessCasbinDeleteApi = (data: object) => {
  return service({
    url: `/v1/access/casbin/delete`,
    method: "DELETE",
    data,
  });
};

// 人员绑定
export const useAccessCasbinEmployeePageApi = (params: object) => {
  return service<any, Response<PageResponse<CodeName>>>({
    url: `/v1/access/casbinEmployee/page`,
    method: "GET",
    params,
  });
};

export const useAccessCasbinEmployeeCreateApi = (data: object) => {
  return service({
    url: `/v1/access/casbinEmployee/create`,
    method: "POST",
    data,
  });
};

export const useAccessCasbinEmployeeDeleteApi = (data: object) => {
  return service({
    url: `/v1/access/casbinEmployee/delete`,
    method: "DELETE",
    data,
  });
};

// 组织绑定
export const useAccessCasbinOrganizationPageApi = (params: object) => {
  return service<any, Response<PageResponse<CodeName>>>({
    url: `/v1/access/casbinOrganization/page`,
    method: "GET",
    params,
  });
};

export const useAccessCasbinOrganizationCreateApi = (data: object) => {
  return service({
    url: `/v1/access/casbinOrganization/create`,
    method: "POST",
    data,
  });
};

export const useAccessCasbinOrganizationDeleteApi = (data: object) => {
  return service({
    url: `/v1/access/casbinOrganization/delete`,
    method: "DELETE",
    data,
  });
};

// 职位绑定
export const useAccessCasbinPositionPageApi = (params: object) => {
  return service<any, Response<PageResponse<CodeName>>>({
    url: `/v1/access/casbinPosition/page`,
    method: "GET",
    params,
  });
};

export const useAccessCasbinPositionCreateApi = (data: object) => {
  return service({
    url: `/v1/access/casbinPosition/create`,
    method: "POST",
    data,
  });
};

export const useAccessCasbinPositionDeleteApi = (data: object) => {
  return service({
    url: `/v1/access/casbinPosition/delete`,
    method: "DELETE",
    data,
  });
};

// 设备绑定
export const useAccessCasbinDoorPageApi = (params: object) => {
  return service({
    url: `/v1/access/casbinDoor/page`,
    method: "GET",
    params,
  });
};

export const useAccessCasbinDoorCreateApi = (data: object) => {
  return service({
    url: `/v1/access/casbinDoor/create`,
    method: "POST",
    data,
  });
};

export const useAccessCasbinDoorDeleteApi = (data: object) => {
  return service({
    url: `/v1/access/casbinDoor/delete`,
    method: "DELETE",
    data,
  });
};

